package com.ysstech.common.enums;

import java.util.Arrays;
import java.util.Objects;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 系统常量
 *
 * @author lsl
 */
@Getter
@AllArgsConstructor
public enum YssMarketEnum implements BaseEnum<String> {
    H("H", "上海"),
    S("S", "深圳"),
    D("D", "大连"),
    Z("Z", "郑州"),
    J("J", "中金所"),
    HK("HK", "香港");
    private final String code;
    private final String desc;

    public static YssMarketEnum getEnum(String code) {
        return Arrays.stream(values()).filter(b -> Objects.equals(b.code, code)).findFirst().orElse(null);
    }

    public static String getEnumDesc(String code) {
        YssMarketEnum e = getEnum(code);
        return e != null ? e.desc : null;
    }
}
